#include "mywidget.h"
#include <QPainter>
#include <QPaintEvent>

MyWidget::MyWidget(QWidget *parent) :
    QWidget(parent)
{
    m_color = Qt::green;
}

void MyWidget::paintEvent(QPaintEvent *pe)
{
    QPainter p(this);

    p.setBrush(m_color);
    p.drawEllipse(pe->rect());
}

void MyWidget::updateShape(const QString &text)
{
    if( text == "red" )
        m_color = Qt::red;
    else
        m_color = Qt::green;
    emit update();

}
